package org.mtmi.ui.scenes.actions;

import org.mtmi.ui.IMG;
import org.mtmi.ui.actions.Action;
import org.mtmi.ui.drawables.IDrawable;
import org.mtmi.ui.scenes.Scene;
import org.mtmi.ui.scenes.SceneManager;

public class LastSceneAction extends Action
{
	
	public LastSceneAction() {
		super( PUSH );
	}
	
	@Override
	public String getText() {
		return "Last Scene";
	}
	
	@Override
	public IDrawable getImage() {
		return IMG.GetD( IMG.I_LAST_SCENE );
	}
	
	@Override
	public boolean isEnabled() {
		return SceneManager.getDefault().hasNext();
	}
	
	@Override
	public void run() {
		SceneManager sm = SceneManager.getDefault();
		int c = sm.getSceneCount();
		if( c>0 ) {
			Scene scenes[] = sm.getScenes();
			sm.setScene( scenes[ scenes.length-1 ] );
		}
	}
}
